namespace Intelli.Cust.Svcs.Models
{
    /// <summary>
    /// 智能客服响应模型
    /// </summary>
    public class CustomerServiceResponse
    {
        public string MessageId { get; set; } = Guid.NewGuid().ToString();
        public string Content { get; set; } = string.Empty;
        public ResponseType Type { get; set; }
        public List<SuggestedAction> SuggestedActions { get; set; } = new();
        public Dictionary<string, object> Metadata { get; set; } = new();
        public DateTime Timestamp { get; set; } = DateTime.UtcNow;
        public bool RequiresHumanIntervention { get; set; }
        public string? ErrorMessage { get; set; }
    }

    /// <summary>
    /// 响应类型
    /// </summary>
    public enum ResponseType
    {
        Text,           // 文本回复
        Action,         // 需要执行操作
        Question,       // 询问用户
        Error,          // 错误信息
        Redirect        // 转人工
    }

    /// <summary>
    /// 建议操作
    /// </summary>
    public class SuggestedAction
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        public string Title { get; set; } = string.Empty;
        public string Description { get; set; } = string.Empty;
        public ActionType Type { get; set; }
        public Dictionary<string, object> Parameters { get; set; } = new();
    }

    /// <summary>
    /// 操作类型
    /// </summary>
    public enum ActionType
    {
        CreateWorkOrder,        // 创建工单
        QueryProduction,        // 查询生产信息
        AdjustSchedule,         // 调整计划
        ViewManual,            // 查看手册
        ContactHuman,          // 联系人工
        Other,                 // 其他
        QueryStatus,           // 查询设备运行状态
        QueryProductionHistory, // 查询历史产量
        QueryDeviceInfo,       // 查询设备信息
        SetTimeRange,          // 设置时间范围
        ApplyPermission,       // 申请权限
        ViewAlarmHistory,      // 查看报警历史
        ExportReport           // 导出报告
    }

    /// <summary>
    /// 对话历史
    /// </summary>
    public class ConversationHistory
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        public string SessionId { get; set; } = string.Empty;
        public string UserId { get; set; } = string.Empty;
        public string UserInput { get; set; } = string.Empty;
        public string? AssistantResponse { get; set; }
        public DateTime Timestamp { get; set; }
        public int? UserRating { get; set; }
        public string? UserFeedback { get; set; }
        public bool IsProcessed { get; set; }
    }

    /// <summary>
    /// 知识库文档
    /// </summary>
    public class KnowledgeDocument
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        public string Title { get; set; } = string.Empty;
        public string Content { get; set; } = string.Empty;
        public string Category { get; set; } = string.Empty;
        public List<string> Tags { get; set; } = new();
        public Dictionary<string, object> Metadata { get; set; } = new();
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
        public string CreatedBy { get; set; } = string.Empty;
    }

    /// <summary>
    /// MES API请求模型
    /// </summary>
    public class MESApiRequest
    {
        public string Endpoint { get; set; } = string.Empty;
        public string Method { get; set; } = "GET";
        public Dictionary<string, object> Parameters { get; set; } = new();
        public object? Body { get; set; }
        public Dictionary<string, string> Headers { get; set; } = new();
    }

    /// <summary>
    /// MES API响应模型
    /// </summary>
    public class MESApiResponse
    {
        public bool Success { get; set; }
        public object? Data { get; set; }
        public string? ErrorMessage { get; set; }
        public int StatusCode { get; set; }
        public Dictionary<string, object> Metadata { get; set; } = new();
    }
} 